import { Breadcrumb } from "antd";
import { connect } from "react-redux";
import { useLocation } from "react-router-dom";

function BreadcrumbNav(props: any) {
    const {pathname} = useLocation();
    const breadcrumbList = props.breadcrumb.breadcrumbList[pathname] || []
    const breadcrumbListTitle = breadcrumbList.map((item: any) => {
        return {
            title: item
        }
    })
    
    return (
        <>
            <Breadcrumb style={{ margin: '16px 0' }}
                    items={breadcrumbListTitle}
                />
        </>
      );
}

// export default BreadcrumbNav;
const mapStateToProps = (state: any) => state;
export default connect(mapStateToProps)(BreadcrumbNav);